#pragma once
#include<iostream>
#include"comm.hpp"

class client
{
public:
    client():_fp(-1)
    {}

    bool openpipe()//打开文件
    {
        _fp = open(pipefile.c_str(),O_WRONLY);//打开文件
        if(_fp < 0)
        {
            std::cerr << "打开文件失败" << std::endl;
            return false;
        }
        std::cout << "打开文件成功" << std::endl;
        return true;
    }
    int wpipe(const std::string & in)//读字符串
    {
       return  ::write(_fp,in.c_str(),in.size());
    }
    void closepipe()//关闭文件
    {
        if(_fp > 0) ::close(_fp);
    }
    ~client()
    {

    }
private:
    int _fp; 
};